1
00:00:00,160 --> 00:00:01,724
Motion sensors.

2
00:00:01,724 --> 00:00:02,946
You’ve seen ‘em.

3
00:00:02,946 --> 00:00:05,511
But have you&nbsp;ever wondered how they work?

4
00:00:05,511 --> 00:00:10,874
There are several kinds out there
but the most common one is the&nbsp;passive infrared sensor.

5
00:00:10,874 --> 00:00:16,063
You might already know that these detect your body heat,
but how does it&nbsp;do that?

6
00:00:16,063 --> 00:00:23,243
And what’s going on inside here to, y’know,
actually determine that something is&nbsp;moving and not just warm?

7
00:00:23,243 --> 00:00:29,943
Like so many of the ubiquitous devices in our lives,
the fundamental&nbsp;thing this is doing is incredibly simple.

8
00:00:29,943 --> 00:00:34,823
But look at how all its pieces fit together
and&nbsp;you’ll start to uncover something amazing.

9
00:00:34,823 --> 00:00:37,336
First, let’s talk about you.

10
00:00:37,336 --> 00:00:39,094
You’re glowing&nbsp;today!

11
00:00:39,094 --> 00:00:41,402
Quite radiantly, I might add.

12
00:00:41,402 --> 00:00:42,485
We all are!

13
00:00:42,485 --> 00:00:44,431
In the infrared.

14
00:00:44,431 --> 00:00:46,304
To quote some website I&nbsp;found,

15
00:00:46,304 --> 00:00:51,409
“All matter with a temperature greater than absolute zero emits thermal radiation”

16
00:00:51,409 --> 00:00:55,084
and we matter! And greater than absolute zero.

17
00:00:55,084 --> 00:00:58,399
So our bodies radiate some infrared&nbsp;light.

18
00:00:58,399 --> 00:01:04,361
Now, fun fact about infrared light, 
when it lands on stuff it heats that stuff up.

19
00:01:04,361 --> 00:01:11,109
So you literally make everyone and everything around you
just a little bit warmer simply&nbsp;by being there.

20
00:01:11,109 --> 00:01:12,921
And that’s affirmative!

21
00:01:12,921 --> 00:01:14,784
And also useful!

22
00:01:14,784 --> 00:01:18,946
Because of a little phenomenon called pyroelectricity.

23
00:01:18,946 --> 00:01:21,101
Turns out there are these crystals —

24
00:01:21,101 --> 00:01:23,179
no not like that actual&nbsp;crystals —

25
00:01:23,179 --> 00:01:26,935
which generate a little bit of voltage when they are heated up.

26
00:01:26,935 --> 00:01:29,723
Gallium&nbsp;nitride is one such crystal.

27
00:01:29,723 --> 00:01:36,559
It’s a really, really small effect producing only a wee bit&nbsp;
of voltage so it’s not like they’re useful for doing work

28
00:01:36,559 --> 00:01:41,081
but thanks to the extremely&nbsp;sensitive field-effect transistor or FET,

29
00:01:41,160 --> 00:01:45,977
pyroelectric crystals can be used to detect&nbsp;changes in heat.

30
00:01:45,977 --> 00:01:50,381
Hook one of these crystals up to the gate 
of a sufficiently sensitive transistor

31
00:01:50,381 --> 00:01:56,719
and you can&nbsp;produce a large electrical signal
when the crystal heats up even just a tiny little bit.

32
00:01:56,719 --> 00:02:05,539
Since your&nbsp;body is constantly radiating infrared light, 
that means a pyroelectric crystal&nbsp;could be used to detect your presence.

33
00:02:05,539 --> 00:02:08,458
Except… no.

34
00:02:08,458 --> 00:02:12,562
If you glitched into existence right&nbsp;in front of a pyroelectric crystal

35
00:02:12,562 --> 00:02:17,309
[fwoop]
it would produce a blip of voltage as your body heat raised&nbsp;its temperature

36
00:02:17,309 --> 00:02:20,123
but then… well it would stop.

37
00:02:20,123 --> 00:02:26,469
It’s only the change in temperature that produces the&nbsp;voltage, 
otherwise we’d have something of a free energy device on our hands.

38
00:02:26,469 --> 00:02:30,231
So once your body&nbsp;heat brought it to a new equilibrium temperature,

39
00:02:30,520 --> 00:02:32,531
the voltage would go away.

40
00:02:32,531 --> 00:02:35,251
But also,&nbsp;we don’t want that anyway.

41
00:02:35,251 --> 00:02:41,456
Such a sensor would react to anything near it&nbsp;
that quickly changes temperature - say a heater switching on.

42
00:02:41,456 --> 00:02:43,729
And that’s&nbsp;not what we’re trying to detect.

43
00:02:43,729 --> 00:02:45,468
But what if you had…

44
00:02:45,468 --> 00:02:46,874
two of them?

45
00:02:46,874 --> 00:02:49,795
If one&nbsp;crystal warmed up but the other didn’t,

46
00:02:49,795 --> 00:02:54,601
there'd be an imbalance in voltage
between the&nbsp;two which could be measured.

47
00:02:54,601 --> 00:03:04,945
So if you can figure out a way to cause a person&nbsp;moving in front of a device with a pair of pyroelectric crystals to heat only one of&nbsp;them at a time,

48
00:03:04,945 --> 00:03:07,881
you could detect that person’s movement.

49
00:03:07,881 --> 00:03:11,023
Which brings us to these:

50
00:03:11,023 --> 00:03:17,155
here I have&nbsp;two common types of passive infrared sensor,
both used in lighting products.

51
00:03:17,155 --> 00:03:23,944
The translucent&nbsp;piece of plastic you find on the front of both sensors
is actually a complicated lens.

52
00:03:23,944 --> 00:03:31,709
They&nbsp;look cloudy since they’re not transparent to visible light,
but this material affects infrared&nbsp;light just as if it were glass.

53
00:03:31,709 --> 00:03:38,964
And sitting behind the lens (quite far behind it as a matter of&nbsp;fact)
is our pair of pyroelectric crystals.

54
00:03:38,964 --> 00:03:45,123
They’re inside this metal can and hiding&nbsp;underneath a filter 
which rejects visible light so we can’t see them,

55
00:03:45,123 --> 00:03:48,745
but I've got a Dremel&nbsp;tool with a cutoff wheel so that won’t stop me!

56
00:03:48,745 --> 00:03:50,541
And what’s inside?

57
00:03:50,541 --> 00:03:52,987
The letter H.

58
00:03:52,987 --> 00:03:58,569
This may not&nbsp;look like much but this is in fact a pair of pyroelectric crystals.

59
00:03:58,569 --> 00:04:02,639
OK, well the H isn’t -&nbsp;at least, I don’t think it is.

60
00:04:02,639 --> 00:04:08,444
Full disclosure, I don’t really understand how this is&nbsp;
constructed or indeed what the crystals are -

61
00:04:08,444 --> 00:04:11,669
it may be gallium nitride, but it could&nbsp;be something else.

62
00:04:11,669 --> 00:04:14,862
Pyroelectricity is exhibited in lots of stuff.

63
00:04:14,862 --> 00:04:18,543
And I’m not even sure this is&nbsp;only two crystals.

64
00:04:18,543 --> 00:04:25,826
If you look closely, you’ll see that there’s a translucent,
vaguely shiny and&nbsp;stripy pattern on top of the H.

65
00:04:25,826 --> 00:04:32,063
That could be a series of crystals,
and my intuition&nbsp;tells me the H we see below them

66
00:04:32,063 --> 00:04:39,649
is a printed pattern on their support which helps maximize&nbsp;
the temperature differential between different areas of the crystal surface

67
00:04:39,649 --> 00:04:44,615
by absorbing more&nbsp;IR in some spots and reflecting more in others.

68
00:04:44,615 --> 00:04:49,957
I was looking through some data sheets for similar&nbsp;
parts and this arrangement isn’t always the same,

69
00:04:49,957 --> 00:04:55,813
which leads me to believe that the actual sensor&nbsp;
element can be tuned for different applications.

70
00:04:55,813 --> 00:05:02,267
Regardless of the specifics, look closely and&nbsp;
you’ll see that the crystal is sort of floating above…

71
00:05:02,267 --> 00:05:03,505
something.

72
00:05:03,505 --> 00:05:06,326
So I broke it to see what that&nbsp;something was.

73
00:05:06,326 --> 00:05:10,436
And it’s a small transistor package containing a FET.

74
00:05:10,436 --> 00:05:15,005
Now that we can see everything,&nbsp;
we can figure out how this component works.

75
00:05:15,005 --> 00:05:20,222
Its three pins which attach it to a circuit board&nbsp;
are labeled V, G, and S.

76
00:05:20,222 --> 00:05:23,080
That’s voltage, ground, and signal.

77
00:05:23,080 --> 00:05:31,630
Then if we look back at the&nbsp;component’s topside, we see that 
the voltage and signal pins are connected to the source and drain&nbsp;of the FET.

78
00:05:31,630 --> 00:05:36,584
But the ground connection - that went to one side of the crystal element.

79
00:05:36,584 --> 00:05:42,353
And, before&nbsp;I destroyed it, the other side of the crystal
was connected to the gate of the FET.

80
00:05:42,353 --> 00:05:44,840
Just like I said a few paragraphs ago!

81
00:05:44,920 --> 00:05:49,760
Now, you might be a bit confused here&nbsp;
because I said there were two crystals&nbsp;&nbsp;

82
00:05:49,760 --> 00:05:54,900
and yet there’s only one structure&nbsp;connected to one transistor.

83
00:05:54,900 --> 00:05:57,389
Well, here’s the really clever bit.

84
00:05:57,389 --> 00:06:02,669
The two crystal&nbsp;elements found on this structure have opposite polarity.

85
00:06:02,669 --> 00:06:07,721
While one produces a positive voltage,&nbsp;
the other produces a negative voltage.

86
00:06:07,721 --> 00:06:15,542
This means that if the whole structure heats up,
while&nbsp;both crystals will produce some voltage, they perfectly oppose each other.

87
00:06:15,542 --> 00:06:19,154
And&nbsp;the net effect is… nothing happens.

88
00:06:19,154 --> 00:06:21,044
Why do we want this?

89
00:06:21,044 --> 00:06:25,363
Well, let’s say there was a&nbsp;bright flash of light - maybe from lightning.

90
00:06:25,363 --> 00:06:34,187
That will actually cause a voltage spike in a pyroelectric&nbsp;material
because that visible light also becomes heat when it’s absorbed by it.

91
00:06:34,187 --> 00:06:36,923
But we don’t want the sensor to&nbsp;react to that.

92
00:06:36,923 --> 00:06:41,033
Thanks to the opposing polarity of the crystals it won’t.

93
00:06:41,033 --> 00:06:44,479
If the entire sensor&nbsp;area is heated uniformly,

94
00:06:44,479 --> 00:06:51,542
the equal and opposite voltages produced in the two halves
of the&nbsp;pyroelectric element cancel each other out.

95
00:06:51,542 --> 00:06:52,989
But…

96
00:06:52,989 --> 00:06:59,793
If it’s only partially heated,
then only one&nbsp;crystal produces voltage while the other doesn’t.

97
00:06:59,793 --> 00:07:05,689
That means there’s an imbalance, 
so there’s a&nbsp;voltage potential across the entire structure.

98
00:07:05,689 --> 00:07:10,418
And, since that structure is connected across&nbsp;
ground and the gate of the transistor,

99
00:07:10,418 --> 00:07:18,120
that difference in heat (and thus difference in potential)
will trigger&nbsp;the FET and it will in turn produce a blip on the signal pin.

100
00:07:18,120 --> 00:07:20,851
Which brings us back to the&nbsp;lens.

101
00:07:20,851 --> 00:07:23,060
I mean, lenses.

102
00:07:23,060 --> 00:07:29,551
If I remove this and we look at the backside,
you’ll see that this is&nbsp;actually a bunch of Fresnel lenses.

103
00:07:29,551 --> 00:07:36,128
Counting each section with a circle bit as one lens&nbsp;
means there are twenty-eight lenses in total.

104
00:07:36,200 --> 00:07:41,720
Unfortunately because this is designed to&nbsp;
bend infrared light and not visible light&nbsp;&nbsp;

105
00:07:41,720 --> 00:07:46,237
I can’t demonstrate what this lens is actually&nbsp;
doing all that well.

106
00:07:46,237 --> 00:07:51,636
But if I stick my phone’s flashlight behind it
at roughly the same position&nbsp;the crystals sit,

107
00:07:51,636 --> 00:07:57,000
you might be able to see that only one section of the lens lights up brightly,

108
00:07:57,000 --> 00:08:01,841
and which section lights up changes as I move the camera around.

109
00:08:01,841 --> 00:08:07,516
Of course, in practice,&nbsp;
this is designed to collect light and focus it on the sensor

110
00:08:07,516 --> 00:08:10,404
so what I’m demonstrating here is&nbsp;backwards.

111
00:08:10,404 --> 00:08:18,401
But hopefully this helps you understand that each section of this lens is looking&nbsp;at a narrow slice of what’s in front of it.

112
00:08:18,401 --> 00:08:20,437
And what goes in front of it?

113
00:08:20,437 --> 00:08:21,663
You!

114
00:08:21,663 --> 00:08:25,820
The infrared&nbsp;light your body is emitting will be collected by these lenses

115
00:08:25,820 --> 00:08:32,414
and projected onto the inside surface of the enclosure
as a series of fuzzy spots.

116
00:08:32,414 --> 00:08:38,342
Since it’s infrared light, wherever those spots land heats up just a&nbsp;tiny bit.

117
00:08:38,342 --> 00:08:46,773
And here’s the key: as you move in front of the lenses,
those fuzzy spots of infrared&nbsp;light will move, too.

118
00:08:46,773 --> 00:08:53,825
And some of them will end up sweeping across the crystal face,
heating one&nbsp;side first, and then the other.

119
00:08:53,825 --> 00:09:00,308
That temperature imbalance as the warm spot sweeps across means&nbsp;there’s a voltage imbalance in the crystal,

120
00:09:00,308 --> 00:09:03,513
and that imbalance is what triggers the transistor.

121
00:09:03,513 --> 00:09:13,384
With each lens collecting light from a small slice of its field of view, these sweeps of IR&nbsp;across the sensor repeat as you continue moving.

122
00:09:13,384 --> 00:09:15,320
Do you understand how that works?

123
00:09:15,320 --> 00:09:18,320
It's&nbsp;tough because I can’t show you this but

124
00:09:18,320 --> 00:09:21,486
I can show you stock footage of a disco ball!

125
00:09:21,486 --> 00:09:25,734
As the&nbsp;ball turns
(this clip is only seven seconds long, so it’s gonna loop a lot)

126
00:09:26,066 --> 00:09:28,972
as the ball&nbsp;turns (this clip is only sev…

127
00:09:28,972 --> 00:09:30,079
sorry couldn’t resist).

128
00:09:30,079 --> 00:09:37,901
As the ball turns, thanks&nbsp;to the fog machine in the room,
we can see the moving beams of light that&nbsp;sweep across the space.

129
00:09:37,901 --> 00:09:45,218
The same thing would happen if the ball were motionless
but the light&nbsp;shining on it was moving around the ball.

130
00:09:45,218 --> 00:09:51,509
And if we look at the walls of the room,
you’ll see that&nbsp;those spots of light are sweeping across the walls.

131
00:09:51,509 --> 00:09:56,520
This motion sensor is basically exactly that, but&nbsp;in reverse.

132
00:09:56,520 --> 00:10:03,629
The lens is collecting your body heat
and creating hot spots inside this enclosure,&nbsp;focused on the sensor.

133
00:10:03,629 --> 00:10:07,462
As you move in front of this thing, those spots move, too.

134
00:10:07,462 --> 00:10:16,059
When they sweep&nbsp;across the two halves of the pyroelectric crystal, it generates enough voltage to trigger the&nbsp;transistor and produce a signal blip.

135
00:10:16,059 --> 00:10:21,560
Then, the electronics inside the device will…&nbsp;
do whatever it is they’re supposed to do.

136
00:10:21,640 --> 00:10:27,456
And by the way, infrared motion sensors
can be more like&nbsp;disco balls than you may realize.

137
00:10:27,456 --> 00:10:33,909
When the front face of one of these looks uniform
rather than segmented, sometimes it isn’t a lens.

138
00:10:33,909 --> 00:10:37,868
Instead it might be a simple window that’s transparent&nbsp;to infrared,

139
00:10:37,868 --> 00:10:45,053
and behind it is a segmented mirror focusing
and reflecting light onto the pyroelectric sensor.

140
00:10:45,053 --> 00:10:49,029
Those&nbsp;mirror segments reflect your body heat onto the face of the crystal,

141
00:10:49,029 --> 00:10:56,982
and just like the segmented&nbsp;lens, the spots of heat your body generates on the crystal move across it as you move around.

142
00:10:56,982 --> 00:11:03,280
A sweep across produces a voltage imbalance,
which triggers the FET, and the&nbsp;electronics react accordingly.

143
00:11:03,280 --> 00:11:09,626
Speaking of electronics, this module is the&nbsp;
kind of module you typically find on an outdoor floodlight.

144
00:11:09,626 --> 00:11:12,520
And it has a distance adjustment.

145
00:11:12,520 --> 00:11:19,246
These knobs turn potentiometers on the board:
one for the time the light should stay on after&nbsp;being triggered

146
00:11:19,246 --> 00:11:21,609
and the other labeled distance.

147
00:11:21,609 --> 00:11:31,493
What that distance adjustment does is change how&nbsp;many signal blips from the sensor are required in a given time for the module to interpret&nbsp;movement.

148
00:11:31,493 --> 00:11:36,110
Set at its furthest distance, it may react to just a couple of blips.

149
00:11:36,110 --> 00:11:44,794
But&nbsp;you can dull its sensitivity by requiring the logic to see more blips from the&nbsp;sensor before it switches the lights on.

150
00:11:44,794 --> 00:11:47,364
How does that change the distance it sees?

151
00:11:47,364 --> 00:11:53,866
You probably noticed already that some of the lens elements are smaller and they’re aimed in&nbsp;different directions.

152
00:11:53,866 --> 00:12:01,034
The smaller lenses at the bottom won’t produce as bright
of an infrared spot on the inside as&nbsp;their larger neighbors,

153
00:12:01,034 --> 00:12:04,015
and since they’re aimed in slightly different directions,

154
00:12:04,015 --> 00:12:12,019
you have to&nbsp;be closer to this (with your body taking up more of its angular view)
for those lens segments to&nbsp;trigger the sensor.

155
00:12:12,019 --> 00:12:16,912
So, if you require more sensor blips in a given period to trigger this,

156
00:12:16,912 --> 00:12:28,044
the thing&nbsp;it’s reacting to needs to be closer to it so it’s seen by more of the lens elements and causes more&nbsp;IR sweeps and thus more signal blips more quickly.

157
00:12:28,044 --> 00:12:34,711
Of course, there are plenty of other designs&nbsp;you can play with,
but like everything in life, there are tradeoffs.

158
00:12:34,711 --> 00:12:43,442
The golf ball lookin' lens&nbsp;on this solar light, since it’s a hemisphere,
is able to detect movement across a wider&nbsp;field of view.

159
00:12:43,442 --> 00:12:48,416
You often see this kind of sensor on ceilings to detect room occupancy.

160
00:12:48,416 --> 00:12:51,974
But since&nbsp;each lens element is very small,

161
00:12:51,974 --> 00:12:57,698
you have to be pretty close to this
for your body heat to&nbsp;affect the pyroelectric crystal.

162
00:12:57,698 --> 00:13:03,596
That gives it a limited detection range,
and since the lens&nbsp;elements are mostly uniform,

163
00:13:03,596 --> 00:13:12,372
while you could in theory adjust its sensitivity that won’t correspond as&nbsp;nicely to distance as it does with this design.

164
00:13:12,372 --> 00:13:20,291
You can also use the lens elements and their size to&nbsp;
calibrate how large of a living creature you want this to react to.

165
00:13:20,291 --> 00:13:25,977
Lots of home security systems&nbsp;
have motion sensors that don’t react to pets,

166
00:13:25,977 --> 00:13:32,427
and one way that's is accomplished is by using&nbsp;
lens elements that are simply too small to generate enough heat on the crystal

167
00:13:32,427 --> 00:13:35,870
unless&nbsp;it's a human-sized thing walking in front of it.

168
00:13:35,870 --> 00:13:40,565
It may also use smaller lens elements&nbsp;for areas facing the floor.

169
00:13:40,565 --> 00:13:49,350
Since the actual sensor in these is so simple, tweaks to the lens and
careful calibration&nbsp;is really the name of the game here.

170
00:13:49,350 --> 00:13:52,670
And speaking of names, we've reached the end of the video.

171
00:13:52,670 --> 00:13:55,761
And as you might have noticed, at the end of every video

172
00:13:55,761 --> 00:13:58,015
(well&nbsp;almost every video sometimes I’m lazy)

173
00:13:58,015 --> 00:14:00,492
this scrolling list of names appears.

174
00:14:00,492 --> 00:14:04,852
These are&nbsp;some of the lovely people who are supporting my work via Patreon.

175
00:14:04,852 --> 00:14:11,008
I haven’t really talked about Patreon&nbsp;in a long time because,
to be honest, I’m doing just fine.

176
00:14:11,008 --> 00:14:19,834
But in the video I just made where I&nbsp;was fawning over awnings,
it was dawning on some folks that I’ve never done a sponsored segment or&nbsp;ad read.

177
00:14:19,834 --> 00:14:21,481
And that’s true!

178
00:14:21,481 --> 00:14:28,667
I’ve never explicitly said that since I don’t like tooting my own horn,
and also that's a weird thing to brag about:

179
00:14:28,667 --> 00:14:31,541
it's not like I begrudge anyone for doing ad reads.

180
00:14:31,541 --> 00:14:33,743
Especially if they’re funny.

181
00:14:33,743 --> 00:14:38,109
But truly,&nbsp;the reason I'm not doing that is these folks!

182
00:14:38,109 --> 00:14:44,417
I consider myself very lucky that I don’t have to&nbsp;
read words somebody at a PR firm wrote for me,

183
00:14:44,417 --> 00:14:48,991
and so long as I can keep going as I am now, I won’t.

184
00:14:48,991 --> 00:14:57,762
So as the&nbsp;jazz fades in, I want to give a heartfelt thanks not just to the people you see here but everyone&nbsp;who supports my work on Patreon.

185
00:14:57,762 --> 00:15:02,803
I’ve got a lot of cool plans lined up
and they’re all made possible by&nbsp;people like you.

186
00:15:02,803 --> 00:15:03,682
And thank you!

187
00:15:05,268 --> 00:15:06,678
What is this, PBS?

188
00:15:07,523 --> 00:15:10,180
♫ pyroelecrtrically smooth jazz ♫

189
00:15:10,716 --> 00:15:12,750
But look at how all its… beh.

190
00:15:13,698 --> 00:15:17,003
It may be gallium nitride but it could be something else.

191
00:15:17,003 --> 00:15:19,984
Pyroelectricity&nbsp;is exhibited in… a lot.

192
00:15:19,984 --> 00:15:21,836
What? What am I doing?

193
00:15:22,660 --> 00:15:25,068
STOP CHANGIN’ THE WORDS!

194
00:15:25,068 --> 00:15:26,849
And what goes in front of it?

195
00:15:26,849 --> 00:15:27,807
[confusion]

196
00:15:27,807 --> 00:15:28,960
Oh.

197
00:15:30,360 --> 00:15:31,767
Well that’s a problem.

198
00:15:34,466 --> 00:15:35,839
Are you gon… are&nbsp;you gonna stop?

199
00:15:37,899 --> 00:15:41,108
If you… I need you to stay… I need you to not do that.

200
00:15:41,108 --> 00:15:45,078
And one way this is accomplished is by using smalllllllll what?

201
00:15:45,078 --> 00:15:47,328
When it lands on the stuff...

202
00:15:48,317 --> 00:15:50,370
Well I skipped a skipped some words.

203
00:15:54,841 --> 00:15:55,719
oops!

204
00:15:57,800 --> 00:16:02,275
Speaking of oops, I'm sitting at my desk with the top half of the flood light sensor enclosure and there's a little mirror in there I didn't show you!

205
00:16:02,275 --> 00:16:06,392
It's angled to help the IR coming in from the extreme side areas of the lens make it onto the sensor.

206
00:16:06,392 --> 00:16:10,431
And it looks like it's also throwing the light coming up from the small segments at the bottom back downward.

207
00:16:10,431 --> 00:16:12,738
Neat.

